package at.tasat.solver.queue;

import at.tasat.solver.Queue;
import at.tasat.solver.VariableOccurencesList;

public class StaticVariableOccurencesQueue extends Queue {

	private final VariableComparator comparator;

	public StaticVariableOccurencesQueue(int numVariables, VariableOccurencesList occurencesList) {
		super(numVariables);
		comparator = new VariableComparator(occurencesList);
	}

	@Override
	protected int getIndexForEnqueue(int variableId) {
		assert comparator.isSorted(this);
		int index = 0;
		for (Integer otherVariableId : this) {
			if (comparator.compare(otherVariableId, variableId) < 0) {
				index++;
			} else {
				break;
			}
		}
		return index;
	}

	@Override
	protected int getIndexForReenqueue(int variableId) {
		return 0;
	}

}
